#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int waysToStep(int n) {
        long long dp[1000000];
        dp[0] = 1, dp[1] = 2, dp[2] = 4;
        for (int i = 3; i < n; i++)
        {
            dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
            dp[i] %= 1000000007;
        }
        return dp[n - 1];
    }
};